{include file="common/header"}
<link href="/static/admin/css/other.css" rel="stylesheet">
<main class="lyear-layout-content">
    <div class="container-fluid">
        <div class="row ant-menu-submenu">
            <div class="col-lg-10 col-b90">
                <div class="card">
                    <div class="right-card-header card-header">
                        <h4>{:lang('index.gateway')}</h4>
                    </div>
                    <div class="card-body">
                        <div class="example-box set_evaluation">
                            <div class="form-group row">
                                <div class="col-xs-3">{:lang('index.ws_port')}</div>
                                <div class="col-xs-4">
                                    <input class="form-control" type="text" id="ws_port" value="{$config['WS_port']}">
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-xs-3">{:lang('index.ws_address')}</div>
                                <div class="col-xs-4">
                                    <input class="form-control" type="text" id="ws_address" value="{$config['WS_address']}">
                                </div>
                            </div>
                            <div class="form-group row">
                                <div class="col-xs-3">{:lang('index.ws_intranet')}</div>
                                <div class="col-xs-4">
                                    <input class="form-control" type="text" id="ws_intranet" value="{$config['WS_intranet']}">
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-xs-3">{:lang('index.ws_start_port')}</div>
                                <div class="col-xs-4">
                                    <input class="form-control" type="text" id="ws_start_port" value="{$config['WS_start_port']}">
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-xs-3">{:lang('index.register_ip')}</div>
                                <div class="col-xs-4">
                                    <input class="form-control" type="text" id="register_ip" value="{$config['Register_ip']}">
                                </div>
                            </div>

                            <div class="form-group row">
                                <div class="col-xs-3">{:lang('index.register_port')}</div>
                                <div class="col-xs-4">
                                    <input class="form-control" type="text" id="register_port" value="{$config['Register_port']}">
                                </div>
                            </div>

                            <div class="form-group col-md-12 mt-50">
                                <button type="submit" class="btn btn-default" id="add-set-evaluation">{:lang('public.determine')}</button>
                                <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">{:lang('public.return')}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
{include file="common/footer"}
<script>
    let IM_config = {
        updatePort: "{:adminUrl('admin/Gateway/index')}",
    };

    $(function () {

        /**
         * 提交
         */
        $('#add-set-evaluation').click(function () {

            var data = {
                ws_port: $('#ws_port').val(),
                ws_address: $('#ws_address').val(),
                ws_intranet: $('#ws_intranet').val(),
                register_ip: $('#register_ip').val(),
                register_port: $('#register_port').val(),
                ws_start_port: $('#ws_start_port').val(),
            };
            $.ajax({
                type: "post",
                url: IM_config.updatePort,
                data: data,
                dataType: "json",
                success : function(r) {
                    we_im_msg(r.data);
                    setTimeout(function() {
                        location.reload();
                    },2000);
                }
            });
        });
    });
</script>
<script type="text/javascript" src="/static/admin/js/set.js"></script>
